/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ToolBar1.java
 *
 * Created on Jan 26, 2012, 7:13:07 PM
 */

package INTERFAZ;

import UTILITARIOS.Herramienta;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;

/**
 *
 * @author VICENTE
 */
public class ToolBar1 extends javax.swing.JPanel {

    /** Creates new form ToolBar1 */
    FormPrincipal f;
    public ToolBar1(javax.swing.JFrame padre) {
        this.f=(FormPrincipal) padre;
        initComponents();
        addEventos(padre);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar1 = new javax.swing.JToolBar();
        btnClientes = new javax.swing.JButton();
        btnEmpleado = new javax.swing.JButton();
        btnEntidad = new javax.swing.JButton();
        btnEmpleo = new javax.swing.JButton();
        btnSucursal = new javax.swing.JButton();
        btnPlanInversion = new javax.swing.JButton();
        jToolBar2 = new javax.swing.JToolBar();
        btnCerrar = new javax.swing.JButton();

        jToolBar1.setBackground(new java.awt.Color(220, 228, 238));
        jToolBar1.setFloatable(false);
        jToolBar1.setForeground(new java.awt.Color(220, 228, 238));
        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N

        btnClientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cliente.png"))); // NOI18N
        btnClientes.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnClientes.setFocusable(false);
        btnClientes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnClientes.setLabel("Nuevo Cliente");
        btnClientes.setName("btnClientes"); // NOI18N
        btnClientes.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnClientes);

        btnEmpleado.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/empleado.png"))); // NOI18N
        btnEmpleado.setText("Nuevo Empleado");
        btnEmpleado.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnEmpleado.setFocusable(false);
        btnEmpleado.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnEmpleado.setName("btnEmpleado"); // NOI18N
        btnEmpleado.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnEmpleado);

        btnEntidad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/banco.png"))); // NOI18N
        btnEntidad.setText("Entidad Financiera");
        btnEntidad.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnEntidad.setFocusable(false);
        btnEntidad.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnEntidad.setName("btnEntidad"); // NOI18N
        btnEntidad.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnEntidad);

        btnEmpleo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/empleo.png"))); // NOI18N
        btnEmpleo.setText("Nuevo Empleo");
        btnEmpleo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnEmpleo.setFocusable(false);
        btnEmpleo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnEmpleo.setName("btnEmpleo"); // NOI18N
        btnEmpleo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnEmpleo);

        btnSucursal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/sucur.png"))); // NOI18N
        btnSucursal.setText("Nueva Sucursal");
        btnSucursal.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnSucursal.setFocusable(false);
        btnSucursal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSucursal.setName("btnSucursal"); // NOI18N
        btnSucursal.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnSucursal);

        btnPlanInversion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/plan.png"))); // NOI18N
        btnPlanInversion.setText("Nuevo Plan de Inversion");
        btnPlanInversion.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnPlanInversion.setFocusable(false);
        btnPlanInversion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnPlanInversion.setName("btnPlanInversion"); // NOI18N
        btnPlanInversion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnPlanInversion);

        jToolBar2.setBackground(new java.awt.Color(220, 228, 238));
        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);
        jToolBar2.setName("jToolBar2"); // NOI18N

        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cierre.png"))); // NOI18N
        btnCerrar.setText("Cerrar");
        btnCerrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnCerrar.setFocusable(false);
        btnCerrar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCerrar.setName("btnCerrar"); // NOI18N
        btnCerrar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(btnCerrar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton btnCerrar;
    public javax.swing.JButton btnClientes;
    public javax.swing.JButton btnEmpleado;
    public javax.swing.JButton btnEmpleo;
    public javax.swing.JButton btnEntidad;
    public javax.swing.JButton btnPlanInversion;
    public javax.swing.JButton btnSucursal;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    // End of variables declaration//GEN-END:variables
    
    private void addEventos(final javax.swing.JFrame padre) {
        btnEmpleado.addActionListener( new ActionListener(){
            public void actionPerformed(ActionEvent e) {

                RegistroEmpleado u = new RegistroEmpleado();

                             Herramienta.centerOnScreen(u);
                             u.setModal(true);
                             u.setVisible(true);


            }
        });


         btnClientes.addActionListener( new ActionListener(){
            public void actionPerformed(ActionEvent e) {

                
                RegistroCliente u = new RegistroCliente();

                     Herramienta.centerOnScreen(u);
                        u.setModal(true);
                         u.setVisible(true);
                

            }
        });
                   btnSucursal.addActionListener( new ActionListener(){
                public void actionPerformed(ActionEvent e) {

                    FormSucursal u = new FormSucursal();
                     Herramienta.centerOnScreen(u);
                            u.setModal(true);
                            u.setVisible(true);

                }
            });

           btnPlanInversion.addActionListener( new ActionListener(){
			public void actionPerformed(ActionEvent e) {
                            FormPlanInversion u = new FormPlanInversion(padre);
                             Herramienta.centerOnScreen(u);
                             u.setModal(true);
                             u.setVisible(true);
			}
		});

           btnEntidad.addActionListener( new ActionListener(){
			public void actionPerformed(ActionEvent e) {
                        RegistroEntidad r = new RegistroEntidad();
                            Herramienta.centerOnScreen(r);
                            r.setModal(true);
                            r.setVisible(true);
			}
		});

             btnEmpleo.addActionListener( new ActionListener(){
			public void actionPerformed(ActionEvent e) {

                            FormEmpleo u = new FormEmpleo(padre);
                             Herramienta.centerOnScreen(u);
                             u.setModal(true);
                             u.setVisible(true);


			}
		});

                btnCerrar.addActionListener( new ActionListener(){
			public void actionPerformed(ActionEvent e) {

                            int res = JOptionPane.showConfirmDialog(null, "Seguro que quiere salir de la Aplicación", "Advertencia", JOptionPane.OK_CANCEL_OPTION);
                                if(res ==0)
                                    System.exit(0);
                                    
                          /*  JOptionPane.showMessageDialog(null, "Salir de la Sesion!!", "Advertencia", JOptionPane.OK_OPTION);
                                padre.dispose();

                            Sesion u = new Sesion();
                             Herramienta.centerOnScreen(u);
                                    u.setVisible(true); */
			}
		});


    }

    public JButton getBtnCliente()
    {
        return btnClientes;
    }

}
